/**
 * Fibonacci numbers by Cédric Tabin
 * for Compiler construction
 */

object Fibonacci { 

	//will run the fibonnaci suite
    def main():Unit={{
    		println("This small program calculates some values of the Fibonacci suite...");
        	println("F10 : "+new Fib().process(10));
        	println("F15 : "+new Fib().process(15));
        	println("F18 : "+new Fib().process(18));
    }} //two braces needed for many statements
}
 
class Fib {

	//the sum will hold the values needed
    var sum:Int;
    
    def process(nb:Int):Int = {
        
        sum=1;
        
    	if (2<nb) {
    		sum=this.process(nb-1)/* this is just for the lexer :-) */ +this.process(nb-2);
    	}
    	
    	return sum;
    }
}

//one last comment before quit !
        
